package com.briup.bms.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import com.briup.bms.common.utils.Result;
import com.briup.bms.service.IAuthService;
import com.briup.bms.web.vm.UserToken;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@Api(tags = "认证服务")
@RestController
public class AuthController {
	
	@Autowired
	private IAuthService authService;
	
	@ApiOperation(value = "登录认证",notes = "")
	@ApiImplicitParams({
		@ApiImplicitParam(name = "userId",value = "用户登录id(唯一凭证)",required = true),
		@ApiImplicitParam(name = "password",value = "用户登录密码",required = true)
	})
	@PostMapping("/login")
	public Result<UserToken> login(String userId,String password) {
		UserToken userToken = authService.login(userId, password);
		return Result.success(userToken);
	}
}
